#利用map批量检测用户名是否符合规范=>username符合规范，username不符合规范
# lst = ["dingchengxingyyds","123wangjunkai","wangyuan123_yi","#####w12yy"]
# import re
# def func01(x):
#     if re.findall('^[a-zA-Z_]\w{5,17}$', x):
#         return f"{x}符合规范"
#     else:
#         return f"{x}不符合规范"
# result = map(func01, lst)
# print(list(result))
#
# #filter把合法的用户名显示出来
# print(list(filter(lambda x:re.findall('^[a-zA-Z_]\w{5,17}$', x),lst)))
#
# #匿名函数+reduce实现1*2*3*...*n
# from functools import reduce
# num = int(input("请输入数字:"))
# result =reduce(lambda x,y:x*y,range(1,num+1))
# print(result)
#
# #filter函数：找出[1-100]能被3整除的数

# result = filter(lambda x:x / 3  in range(1,34),range(101))
# print(list(result))

#map函数：求list[1-10]各项的平方
# lst = [1,2,3,4,5,6,7,8,9,10]
# def func(item):
#     return item*item
# result = map(lambda item:item*item,lst)
# print(list(result))

# #将列表[1,4,5,9]转换成’1459'的字符串
# lst = [1,4,5,9] #-->1459
# def func1(x,y):
#     return x*10 +y
# print(reduce(func1,lst))

